<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员登录</title>
    <link rel="stylesheet" href="CSS/login-css.css">
    <link rel="stylesheet" href="../../CSS/font-awesome.min.css">
</head>
<script src="../../js/jquery-3.4.1.min.js"></script>

<body>
<div class="main-div">
    <div class="login-div">
        <div class="logo-div"></div>
        <div class="form-div">
            <div class="parcel-div">
                <div class="form">
                    <div class="tip-div">
                        <span>公共场所不建议自动登录, 以防账号丢失</span>
                    </div>
                    <div class="account-div">
                        <span class="fa fa-user-o fa-lg"></span>
                        <input class="account-input" type="text" placeholder="请输入管理员用户名" name="userName">
                    </div>
                    <div class="account-tip-div"></div>
                    <div class="pwd-div">
                        <span class="fa fa-lock fa-lg"></span>
                        <input class="pwd-input" type="password" placeholder="请输入管理员密码" name="password">
                    </div>
                    <div class="pwd-tip-div"></div>
                    <div class="button-div">
                        <button type="submit" class="btn">登录</button>
                    </div>
                    <div class="login-tip-div"></div>
                    <div class="text-div">
                        <a href="#">忘记密码</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="js/admin_js/zrveeq.js"></script>
<script src="js/admin_js/index.js"></script>
<script>
    $(function () {
        $(".btn").click(function () {
            $.ajax({
                url: "${pageContext.request.contextPath}/user?method=adminLogin",
                type: "POST",
                data: {"userName": $(".account-input").val(),"password":$(".pwd-input").val()},
                dataType: "json",
                success: function (message) {
                    if(message=="1"){
                        location.href = "${pageContext.request.contextPath}/ProgramJSP/goods-Manage.jsp";
                    }else{
                        $(".pwd-tip-div").text("账号或密码错误！").css("color","red");
                    }
                },
                error: function (jqXHR) {
                    alert("失败!");
                }
            });
        });
        $(".pwd-input").click(function () {
            $(".pwd-tip-div").text("");
        });
    })
</script>
</html>
